package com.opal.system.controller;

import com.opal.system.service.OpalDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller()
@RequestMapping("/manage/dept")
public class OpalDeptController {

    @Autowired
    private OpalDeptService opalDeptService;

    /**
     * 获取所有的部门信息
     * @return
     */
    @RequestMapping("/getAllOpalDept")
    @ResponseBody
    public Object getAllOpalDept(){
        return opalDeptService.getAllOpalDept();
    }

    /**
     * 根据组织条件获取相应的部门信息
     * @return
     */
    @RequestMapping("/getOpalDept")
    @ResponseBody
    public Object getOpalDept(String pkOrg){
        return opalDeptService.getOpalDept(pkOrg);
    }

    /**
     * 根据组织条件给easyui的组件tree提供数据
     * @return
     */
    @RequestMapping("/getDeptEasyUiTreeData")
    @ResponseBody
    public Object getDeptEasyUiTreeData(String pkOrg){
        return opalDeptService.getDeptEasyUiTreeData(pkOrg);
    }
}
